package etc.spec.ytt.week09.homework;

import java.util.List;

public class Animal {
    private String name;
    private List sounds;
    private List foods;
    public Animal(){

    }
    public Animal(String name, List sounds, List foods) {
        this.name = name;
        this.sounds = sounds;
        this.foods = foods;
    }
    public void eat(){
        List l=getFoods();
        for (int i = 0; i < l.size(); i++) {
            Food s = (Food) l.get(i);//强制类型转换
            System.out.println(getName() + "吃" + s.getName()+"价格是"+s.getPrice());
        }
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List getSounds() {
        return sounds;
    }

    public void setSounds(List sounds) {
        this.sounds = sounds;
    }

    public List getFoods() {
        return foods;
    }

    public void setFoods(List foods) {
        this.foods = foods;
    }


    public void cry() {
    }
}
